import { useEffect, useState } from "react"
import { Navigate, useNavigate } from "react-router-dom"


export default function NotFount() {
    const [state, setState]=useState(false)
    const navigate=useNavigate()
    useEffect(()=>{
        setTimeout(()=>{
            navigate('/')
        },3000)
    },[])

  return (
    <div>
      <h1>404 Page</h1>
      <p>您访问的页面不存在哦。。。。。。</p>
      {state && <Navigate to='/'></Navigate>}
      <button onClick={()=>setState(true)}>回到首页</button>
    </div>
  )
}
